package cis350.pcr.types;

import cis350.pcr.types.Item;
import cis350.pcr.activities.ResultActivity;

/*
 * A generic instructor, should just be a different name for Item
 */
public class Instructor extends Item {
	public String lastName;
	public Instructor() {
		lastName = "";
	}

	@Override
	public String getRowText() {
		return ResultActivity.capitalize(name);
	}

	@Override
	public String getRowSubtext(boolean average) {
		StringBuffer result = new StringBuffer();
		String sem = "", year = "";
		boolean blank = true;
		for (Semester s : ratings) {
			if (!s.id.equals("")) {
				blank = false;

				// display format: Sp '10, Fa '09, Su '08s
				if (s.id.contains("A"))
					sem = "Sp";
				else if (s.id.contains("B"))
					sem = "Su";
				else if (s.id.contains("C"))
					sem = "Fa";
				year = s.id.substring(2, 4);
				result.append(sem);
				result.append(" '");
				result.append(year);
				/*
				 * display format: 2010A, 2009C, 2008B result.append(s.id);
				 */
				result.append(", ");
				if (!average)
					break;
			}
		}
		if(blank)
			return "";
		return result.toString().substring(0, result.length()-2);
	}

	@Override
	public String getActionBarTitle() {
		return ResultActivity.capitalize(name);
	}
}